<?php
require 'db.php';
$strsql = "select * from student left join major on student.major =  major.Id";

$result = mysqli_query($link, $strsql);
$data = mysqli_fetch_all($result);

mysqli_free_result($result);
mysqli_close($link);

?>
<!DOCTYPE html>
<html>
<head>
<title>文件下载</title>
</head>
<style type="text/css">
    .content{
    	width:500px;
    	height:600px;
    	margin:0 auto;
    	line-height:80px;
    	background-color:#CFCFCF;
    	color:#DC143C;
    	border-radius:10px;
    	border:1px solid black;
        box-shadow:0px 0px 10px 5px #aaa;

    }
    table{
    	width:500px;
    	height:100px;
    	text-align:center;
    	margin:0 auto;
    	background-color:white;
    	border-collapse: collapse;
    	box-shadow:0px 0px 10px 5px #aaa inset;
    }
     table,table tr th, table tr td {
        border:1px solid #ccc;
         }  
    th{
    	color:black;
    }
    a:hover{
    	text-decoration:none;
    	color:#DC143C;
    	font-size:20px;
    }
    a:link , a:visited{
    	text-decoration:none;
    }
    a:active{
    	text-decoration:none;
    	
    }
</style>
<body>
<div class="content">
<a href="new.php">&nbsp;&nbsp;新建数据</a>
<a href="down.php">&nbsp;&nbsp;下载表格</a>
    <table>
    	<tr>
    		<th width="10%">序号</th>
    		<th width="20%">姓名</th>
    		<th width="40%">学号</th>
    		<th width="15%">学科</th>
    		<th width="15%">专业</th>
    	</tr>
    	<?php 
    	foreach ($data as $key => $value){
    	?>
    	<tr class="value">
    		<td><?= $value[0]?></td>
    		<td><?= $value[1]?></td>
    		<td><?= $value[2]?></td>
    		<td><?= $value[3]?></td>
    		<td><?= $value[6]?></td>
    	</tr>
    	<?php 
    	}?>
    </table>
    </div>
</body>
</html>